package com.ruoyi.subject.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.subject.domain.QbExamAnalyse;
import com.ruoyi.subject.domain.QbExamRecord;
import com.ruoyi.subject.domain.QbSubject;
import com.ruoyi.subject.mapper.QbExamRecordMapper;
import com.ruoyi.subject.service.IQbExamRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 考试记录Service业务层处理
 *
 * @author lzhj
 * @date 2021-01-27
 */
@Service
public class QbExamRecordServiceImpl implements IQbExamRecordService {
    @Autowired
    private QbExamRecordMapper qbExamRecordMapper;

    /**
     * 查询考试记录
     *
     * @param id 考试记录ID
     * @return 考试记录
     */
    @Override
    public QbExamRecord selectQbExamRecordById(Long id) {
        return qbExamRecordMapper.selectQbExamRecordById(id);
    }

    /**
     * 查询考试记录列表
     *
     * @param qbExamRecord 考试记录
     * @return 考试记录
     */
    @Override
    public List<QbExamRecord> selectQbExamRecordList(QbExamRecord qbExamRecord) {
        return qbExamRecordMapper.selectQbExamRecordList(qbExamRecord);
    }

    /**
     * 新增考试记录
     *
     * @param qbExamRecord 考试记录
     * @return 结果
     */
    @Override
    public int insertQbExamRecord(QbExamRecord qbExamRecord) {
        qbExamRecord.setCreateTime(DateUtils.getNowDate());
        return qbExamRecordMapper.insertQbExamRecord(qbExamRecord);
    }

    /**
     * 修改考试记录
     *
     * @param qbExamRecord 考试记录
     * @return 结果
     */
    @Override
    public int updateQbExamRecord(QbExamRecord qbExamRecord) {
        qbExamRecord.setUpdateTime(DateUtils.getNowDate());
        return qbExamRecordMapper.updateQbExamRecord(qbExamRecord);
    }

    /**
     * 批量删除考试记录
     *
     * @param ids 需要删除的考试记录ID
     * @return 结果
     */
    @Override
    public int deleteQbExamRecordByIds(Long[] ids) {
        return qbExamRecordMapper.deleteQbExamRecordByIds(ids);
    }

    /**
     * 删除考试记录信息
     *
     * @param id 考试记录ID
     * @return 结果
     */
    @Override
    public int deleteQbExamRecordById(Long id) {
        return qbExamRecordMapper.deleteQbExamRecordById(id);
    }

    @Override
    public List<Map<String, Object>> selectSorceRank() {
        return qbExamRecordMapper.selectSorceRank();
    }

    @Override
    public List<QbExamAnalyse> selectExamAnalyseList(QbExamAnalyse qbExamAnalyse) {
        return qbExamRecordMapper.selectExamAnalyseList(qbExamAnalyse);
    }

}
